import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
	{
		path: '/',
		name: 'login',
		component: () => import("../pages/login/login.vue")
	}, // zxp添加，启动时进入登录页面
	{
		path: "/home",
		name: "home",
		component: () =>
			import("../pages/home/home.vue"),
	},
	{
		path: "/index",
		name: "index",
		component: () =>
			import("../pages/index/index.vue"),
	}, {
		path: "/login",
		name: "login",
		component: () =>
			import("../pages/login/login.vue"),
	}, {
		path: "/form",
		name: "form",
		component: () =>
			import("../pages/form/form.vue"),
	}, {
		path: "/list",
		name: "list",
		component: () =>
			import("../pages/list/list.vue"),
	}, {
		path: "/newList",
		name: "newList",
		component: () =>
			import("../pages/list/newList.vue"),
	}, {
		path: "/serves",
		name: "serves",
		component: () =>
			import("../pages/serves/serves.vue"),
	}, {
		path: "/profile/list",
		name: "profile_list",
		component: () =>
			import("../pages/serves/list.vue"),
	}, {
		path: "/userServes",
		name: "userServes",
		component: () =>
			import("../pages/serves/userServes.vue"),
	}, {
		path: "/userView",
		name: "userView",
		component: () =>
			import("../pages/user/userView.vue"),
	},
	// 黄麒宇添加
	/**
	 * 机构相关页面
	 */
	{
		name: "organization",
		path: "/org",
		component: () => import("../pages/ingi-organization/index.vue"),
		children: [
			{
				name: "organization_setting",
				path: "setting",
				component: () => import("../pages/ingi-organization/setting.vue")
			},
			{
				name: "organization_employee",
				path: "employee",
				component: () => import("../pages/ingi-organization/employee.vue")
			}
		]
	},
	/**
	 * 项目相关页面
	 */
	{
		name: "project",
		path: "/project",
		component: () => import("../pages/ingi-project/index.vue"),
		children: [
			{
				name: "project_list",//列表
				path: "list",
				component: () => import("../pages/ingi-project/list.vue")
			},
			{
				name: "project_event",//项目相关事件
				path: "event",
				component: () => import("../pages/ingi-project/event.vue")
			},
			{
				name: "project_analysis",
				path: "analysis",
				component: () => import("../pages/ingi-project/analysis.vue")
			},
			{
				name: "project_trash",
				path: "trash",
				component: () => import("../pages/ingi-project/trash.vue")
			}
		]
	},
	/**
	 * 服务对象个人档案
	 */
	{
		name: "case_management",
		path: "/case-management",
		component: () => import("../pages/ingi-case-management/index.vue"),
		children: [
			{
				name: "case_management_list",// 列表页，敏感个案处理也在这个页面内处理
				path: "list",
				component: () => import("../pages/ingi-case-management/list.vue")
			}
		]
	},
	/**
	 * 服务记录 - 列表
	 */
	{
		name: "service_list",
		path: "/ingi-service",
		component: () => import("../pages/ingi-serve/list.vue"),
		children: [
			{
				name: "service_enquiry_list",// 咨询服务列表
				path: "enquiry",
				component: () => import("../pages/ingi-serve/enquiry/list.vue"),

			},
			{
				name: "service_case_list",// 个案服务列表
				path: "casework",
				component: () => import("../pages/ingi-serve/casework/list.vue")
			},
			{
				name: "service_regular_home_visit_list",//定期探访服务列表
				path: "regular-home-visit",
				component: () => import("../pages/ingi-serve/regular-home-visit/list.vue")
			},
			{
				name: "service_crisis_intervention_list",// 危机介入服务列表
				path: "crisis-intervention",
				component: () => import("../pages/ingi-serve/crisis-intervention/list.vue")
			}
		]
	},
	/**
	 * 创建  项目内所有“创建”页面都是没有侧边栏的，所以单独定义一个母版
	 */
	{
		name: "service_create",
		path: "/ingi-service",
		component: () => import("../pages/ingi-serve/create.vue"),
		children: [
			{
				name: "case_management_create",// 详情及编辑、创建页面
				path: "/case-management/create",
				component: () => import("../pages/ingi-case-management/detail.vue")
			},
			{
				name: "service_enquiry_create",//创建咨询服务
				path: "enquiry/create",
				component: () => import("../pages/ingi-serve/enquiry/create.vue")
			},
			{
				name: "service_regular_home_visit_create",//创建定期探访服务
				path: "regular-home-visit/create",
				component: () => import("../pages/ingi-serve/regular-home-visit/create")
			},
			{
				name: "service_crisis_intervention",//创建危机介入服务
				path: "crisis-intervention/create",
				component: () => import("../pages/ingi-serve/crisis-intervention/create.vue")
			},
		]
	},
	/**
	 * 服务记录资源库
	 */
	{
		name: 'service_resource',
		path: '/service-resource',
		component: () => import("../pages/ingi-resource/index.vue"),
		children: [
			{
				name: "service_resource_template",
				path: "form-template",
				component: () => import("../pages/ingi-resource/template.vue")
			},
			{
				name: "service_resource_guide",
				path: "guide-form",
				component: () => import("../pages/ingi-resource/guide.vue")
			}
		]
	},
	/**
	 * 用户中心
	 */
	{
		name: "user_center",
		path: "/user_center",
		component: () => import("../pages/ingi-account/index.vue"),
		children: [
			{
				name: "user_center_profile",
				path: "profile",
				component: () => import("../pages/ingi-account/profile.vue")
			},
			{
				name: "user_center_secure",
				path: "secure",
				component: () => import("../pages/ingi-account/secure.vue")
			},
			{
				name: "user_center_binding",
				path: "binding",
				component: () => import("../pages/ingi-account/binding.vue")
			}
		]
	},
	// 朱毅添加 
	{
		path: "/project_management",
		name: "project_management",
		component: () =>
			import("../pages/project-management/index.vue"),
		children: [
			{
				name: "project_management_view",
				path: "view",
				component: () => import("../pages/project-management/view.vue")
			}
		]
	},
];
/*
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location){
	return originalPush.call(this,location).catch(err=>err);
}
 */
const router = new VueRouter({
	mode: "history",
	//base: process.env.BASE_URL,
	base: "/",
	routes,
});

export default router;